﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Bon_It.Model;
using Bonit_It.ViewModel;
using Bonit_It.ViewModel.Base;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BonIt.Tests
{
    [TestClass]
    public class TEntity
    {
        [TestMethod]
        public void ObjectChangedIschangedsetToTrue()
        {
            Users user = new Users();

            user.FirstName = "test";
            Assert.IsTrue(user.IsChanged);
        }

        [TestMethod]
        public void ObjectHasChangedthenRevertChangedIsChangedsetToFalse()
        {
            Users user = new Users();
            user.BeginEdit();
            user.FirstName = "test";
            user.CancelEdit();
            Assert.IsFalse(user.IsChanged);
        }

        [TestMethod]
        public void TestCancelEditTheChangesWillBeRollbacked()
        {
            Users user = new Users();
            user.BeginEdit();
            user.FirstName = "test";
            user.AcceptChanges();
            user.BeginEdit();
            user.FirstName = "test123";
            user.CancelEdit();
            Assert.IsFalse(user.IsChanged);
            Assert.AreEqual("test",user.FirstName);
        }

    }

   
}
